package com.zzyd.factory.model.app;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * @author wjunjie
 * @version 1.0
 * @E-mail wang_junjie007@163.com
 * @company ZZYD
 * @createTime 2018/8/28 16:01
 * @类注释: 全局静态变量
 */
public class Account {
    private static final String KEY_IS_CN = "KEY_IS_CN";
    /**
     * mm交易区
     */
    public static int coinId_mm = 2;
    /**
     * btc交易区
     */
    public static int coinId_btc = 4;
    /**
     * etc交易区
     */
    public static int coinId_etc = 7;
    private static boolean isCN = true;

    private static void save(Context context) {
        SharedPreferences sp = context.getSharedPreferences(Account.class.getName(),
                Context.MODE_PRIVATE);
        sp.edit().putBoolean(KEY_IS_CN, isCN)
                .apply();
    }

    /**
     * 数据加载
     *
     * @param context context
     */
    public static void load(Context context) {
        SharedPreferences sp = context.getSharedPreferences(Account.class.getName(),
                Context.MODE_PRIVATE);
        isCN = sp.getBoolean(KEY_IS_CN, false);
    }

    /**
     * 货币类型
     *
     * @return
     */
    public static boolean getModelIsCN() {
        return isCN;
    }
}
